/**
 * 
 */
package com.idea.auction.controller;



import org.apache.log4j.Logger;
import org.apache.shiro.authz.annotation.RequiresPermissions;

import com.idea.auction.model.User;
import com.idea.auction.service.BillService;
import com.idea.auction.service.UserService;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.kit.StrKit;
import com.jfinal.server.Service;

/**
 * @author y.z
 */
@ControllerBind(controllerKey="/user",viewPath="/pages")
public class UserController extends BaseController {
	private static final Logger log = Logger.getLogger(UserController.class);
	@Service
	private UserService userService;
	/**
	 * 跳转到用户页
	 */
	@RequiresPermissions("user/toUserList")
	public void toUserList(){
		getNavigation();
		render("user/user-list.html");
	}

	
	/**
	 * 获取用户分页
	 */
	public void getUserList(){
		if(!StrKit.isBlank(getPara("curPage"))){
			curPage = getParaToInt("curPage");
		}
		super.setPage(userService.getPage(curPage));
	}


	/**
	 * 通过申请
	 */
	public void passUser(){
		String id=getPara("id");
		User user=new User();
		
		user.set("id", id);
		user.set("is_agent", 2);
		
		if(userService.update(user)){
			msgUpdate();
		}
		
	}
	
}	